SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.4 KB · 22 lines tsx
Raw Blame History
1import { ImageResponse } from 'next/og';2import { Wallpaper } from '@/components/brand/og';3import { TODAY_LABELS } from '@/components/changes/today-sections';4import { apiD3, safe } from '@/lib/api';5import { fmtDate, fmtInt, num } from '@/lib/format';6import { SITE_NAME } from '@/lib/site';78export const runtime = 'nodejs';9export const alt = `Today in AI on ${SITE_NAME}`;10export const size = { width: 1200, height: 630 };11export const contentType = 'image/png';1213/** OG image for /changes/[date]: the day and its live section counts. */14export default async function DailyOgImage({ params }: { params: Promise<{ date: string }> }) {15  const { date } = await params;16  const ok = /^\d{4}-\d{2}-\d{2}$/.test(date);17  const d = ok ? await safe(apiD3.changesDaily(date, 1)) : null;18  const sections = (d?.today ?? []).filter((s) => (num(s.total) ?? 0) > 0).slice(0, 4);19  const counters: [string, string][] = d ? [['Events', fmtInt(d.total)], ...sections.map((s) => [s.label ?? TODAY_LABELS[s.key] ?? s.key, fmtInt(s.total)] as [string, string])] : [];20  return new ImageResponse(<Wallpaper eyebrow="Today in AI" title={ok ? fmtDate(date) : 'Daily digest'} subtitle="Major releases · price moves · benchmark moves · model changes · research · open weights · deprecations · providers · hardware" counters={counters} footer={`www.ai-atlas.co/changes/${ok ? date : ''}`} markPx={220} />, { ...size });21}22